<script setup lang="ts">
import { inject } from 'vue';

    interface Iprops{
        num:number
    }
    const props=defineProps<Iprops>()

    const emit=defineEmits<{
        (e:'uploadNum',num:number):void
    }>()

    const onclick=()=>{
        emit("uploadNum",props.num)
    }

    const number=inject<number>('num')

    const parentChangenum=inject<(n:number)=>void>("parentChangeNum",()=>{})

    const changNum=()=>{
        parentChangenum(1000)
    }
</script>

<template>
  <div class="page">
    <button class="hmSwiper" @click="onclick">{{props.num}}</button>
  </div>

  <div>
    <button @click="changNum">{{number}}</button>
  </div>
</template>

<style scoped>
    .hmSwiper{
        background-color: red;
    }
</style>
